package Framework.Fabricas;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class FabricaConexion {
    
    public static FabricaConexion instancia;

    public static synchronized FabricaConexion getInstancia() {
        if (instancia == null) {
            FabricaConexion instancia = new FabricaConexion();
            return instancia;
        }
        else {
            return instancia;
        }
    }

    public static Connection getConexion() {
        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
        } 
        catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
            System.out.println("Error: " + e.getMessage());
        }
        String URL = "jdbc:mysql://localhost:3306/disenio";
        String user = "root";
        String password = "";
        Connection conexion = null;
        try {
          //  conexion = (Connection)DriverManager.getConnection(URL, user, password);
        	 conexion=DriverManager.getConnection("jdbc:mysql://localhost:3306/disenio","root","");
        	return conexion;
        } 
        catch (SQLException e) {
            return conexion;
        }
    }
}